#version 450

layout(location = 0) in vec3 in_position;
layout(location = 0) out vec3 outUV;

layout(set = 0, binding = 0) uniform PerFrameUniformData {
    mat4 view_proj_mat;
} pfuData;

layout(set = 1, binding = 0) uniform PerObjectUniformData {
    mat4 model_mat;
} pouData;

out gl_PerVertex {
    vec4 gl_Position;
};

void main() {
    vec3 position = vec3(gl_VertexIndex & 1, (gl_VertexIndex & 2) >> 1, (gl_VertexIndex & 4) >> 2) * 2 - 1.0f;

    gl_Position = pfuData.view_proj_mat * pouData.model_mat * vec4(in_position, 1.0f);
    outUV       = (pfuData.view_proj_mat * vec4(position, 1.0f)).xyz;
}